package com.example.system.convert;

import com.example.system.dto.RoleDto;
import com.example.system.entity.Role;
import com.example.system.vo.RoleVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author 王令
 * @since 2022/8/19 21:50
 */
@Mapper
public interface RoleConvert {

    RoleConvert INSTANCE = Mappers.getMapper(RoleConvert.class);

    RoleVo toRoleVo(Role role);

    @Mapping(target = "createdBy", ignore = true)
    @Mapping(target = "tenantId", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "deleted", ignore = true)
    @Mapping(target = "deleteTime", ignore = true)
    Role toRole(RoleDto roleDto);

    List<RoleVo> toRoleVoList(List<Role> roles);
}
